package com.henry.chatkit

import android.view.View
import android.widget.FrameLayout
import android.widget.RelativeLayout
import android.widget.TextView
import com.henry.chatkit.messages.MessageInfo
import com.henry.chatkit.utils.appContext

object Constants {
    var APP_DIR: String? = appContext().getExternalFilesDir(null)?.absolutePath
    var VOICE_DIR: String = "$APP_DIR/voice/"
    var IMAGE_BASE_DIR: String = "$APP_DIR/image/"
    var IMAGE_HEAD_DIR: String = "$IMAGE_BASE_DIR/head/"
    var IMAGE_DOWNLOAD_DIR = IMAGE_BASE_DIR + "download/"

}

object MessageType {
    const val HEADER_VIEW = -99
    const val NONE = 0x00
    const val TEXT = 0x10
    const val IMAGE = 0x20
    const val AUDIO = 0x30
    const val VIDEO = 0x40
    const val FILE = 0x50
    const val LOCATION = 0x60
    const val CUSTOM_FACE = 0x70
    const val CUSTOM = 0x80
    const val VOTE = 0x90
    const val SYSTEM = 0x100
    const val TIPS = 0x110
}

object DataChangeType {
    const val REFRESH = 0
    const val LOAD = 1
    const val ADD_BACK = 2
    const val ADD_FRONT = 3
    const val UPDATE = 4
    const val DELETE = 5
    const val CLEAR = 6
}

object MessageStatus {
    const val NORMAL = 0
    const val SENDING = 1
    const val SEND_SUCCESS = 2
    const val SEND_FAIL = 3
    const val DOWNLOADING = 4
    const val UN_DOWNLOAD = 5
    const val DOWNLOADED = 6
    const val UNREAD = 7
    const val DELETE = 8
    const val REVOKE = 9
}

interface OnItemClickListener {
    fun onMessageClick(view: View?, position: Int, message: MessageInfo?)
    fun onMessageLongClick(view: View?, position: Int, message: MessageInfo?)
    fun onUserIconClick(view: View?, position: Int, message: MessageInfo?)
}

interface OnLoadMoreHandler {
    fun loadMore()
}

interface OnEmptySpaceClickListener {
    fun onClick()
}

interface OnPopActionClickListener {
    fun onCopyClick(position: Int, msg: MessageInfo?)
    fun onSendMessageClick(msg: MessageInfo?, retry: Boolean)
    fun onDeleteMessageClick(position: Int, msg: MessageInfo?)
    fun onRevokeMessageClick(position: Int, msg: MessageInfo?)
}

interface OnCustomMessageDrawListener {
    fun onDraw(parent: CustomMessageViewGroup?, msg: MessageInfo?)
}

interface CustomMessageViewGroup {
    fun addMessageItemView(view: View?)
    fun addMessageContentView(view: View?)
    fun getContentFrame(): FrameLayout
    fun getRootView(): RelativeLayout
    fun updateTime(timeText: TextView?)
}

interface PopActionClickListener {
    fun onActionClick(position: Int, data: Any?)
}

interface ChatLayoutCallback {
    fun loadMessages()
    fun sendMessage(messageInfo: MessageInfo, retry: Boolean)
    fun revokeMessage(position: Int, msg: MessageInfo?)
    fun onMessageClick(view: View?, position: Int, messageInfo: MessageInfo?)
    fun onUserIconClick(view: View?, position: Int, messageInfo: MessageInfo?)
    fun onMessageLongClick(view: View?, position: Int, messageInfo: MessageInfo?)
}
